# Contributor: Danilo Falcão <danilo@falcao.org>
# Maintainer: Danilo Falcão <danilo@falcao.org>
pkgname=py3-pelican
_pkgname=pelican
pkgver=4.9.1
pkgrel=1
pkgdesc="Static site generator written in Python"
url="https://getpelican.com/"
arch="noarch"
license="AGPL-3.0-only"
depends="
	py3-blinker
	py3-docutils
	py3-feedgenerator
	py3-jinja2
	py3-ordered-set
	py3-pygments
	py3-dateutil
	py3-rich
	py3-unidecode
	py3-watchfiles
	py3-markdown
	"
makedepends="
	py3-gpep517
	py3-pdm-backend
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-typogrify
	tzdata
	"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/p/$_pkgname/$_pkgname-$pkgver.tar.gz
	no-locales-for-tests.patch
	remove-shebang.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="pelican" # Backwards compatibility
provides="pelican=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -p no:warnings \
		-k 'not test_datetime and not test_blinker_is_ordered'
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
	rm -r "$pkgdir"/usr/lib/python*/site-packages/pelican/tests
}

sha512sums="
3c5ece93864a29aa296e353e044022864c1c551b7a805adeb0914df9021bdf7a3d3977c91ddeba6c542c8879ff5fe7ca23e0163e17aaa93ed36747f35895937b  pelican-4.9.1.tar.gz
5d4c9a8b19d1614ebbf02850891aaf936652b360d961b6f2a849e66184b26f459dc3c7c2f7931429db750d7bd9dfcebfdc223af5b8cba2ebfe79050ede8ec553  no-locales-for-tests.patch
2bd01659c4cc958b1deb8a9d20cd7585d84228e127050d81c4df424c8e7e4f832fd78f2e42dbc55793788cd8d0ef80cc8bbabb366173ebbfb3bc0a332b308ff6  remove-shebang.patch
"
